package grape.base.rest.client.user;

import grape.base.service.user.dto.UserInnerDetailDto;
import grape.base.service.user.dto.UserThirdCreateParam;
import grape.base.service.user.po.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by yangwei
 * Created at 2020/1/16 10:13
 */
@Component
@FeignClient(value = "grape-base")
public interface UserClient {

    /**
     * 根据用户登录标识查询用户详情
     * @param identifier
     * @return
     */
    @GetMapping(value = "/base/user/inner/details")
    public UserInnerDetailDto details(@RequestParam String identifier,@RequestParam String identifierDictCode);

    /**
     * 根据用户登录标识查询用户详情
     * @param userId
     * @return
     */
    @GetMapping(value = "/base/user/inner/detailsById")
    public UserInnerDetailDto detailsById(@RequestParam String userId);

    /**
     * 根据用户id查询用户
     * @param userId
     * @return
     */
    @GetMapping(value = "/base/user/inner/getUserByUserId")
    public User getUserById(@RequestParam String userId);
    /**
     * 根据用户id查询用户
     * @param userIds
     * @return
     */
    @GetMapping(value = "/base/user/inner/getUserByUserIds")
    public List<User> getUserByIds(@RequestParam List<String> userIds);

    /**
     * 仅用于第三方登录添加或更新用户
     * @param cp
     * @return
     */
    @PostMapping(value = "/base/user/inner/saveOrUpdate")
    public User saveOrUpdateFrontUser(@RequestBody UserThirdCreateParam cp);
}
